/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package group6renderer.renderernode;

import group6renderer.Display;
import group6renderer.Visitor;

import java.util.ArrayList;

/**
 *
 * @author jonnie
 */
public abstract class TreeNode
{
    private ArrayList<TreeNode> children = new ArrayList<TreeNode>();
    public TreeNode parent;
    protected String name;
    
    public abstract void drawNode(Display disp);
    public abstract boolean isLeaf();
    public abstract boolean hasClosing();
    public abstract TreeNode copy();
    public abstract void accept(Visitor theVisitor);
    
    public TreeNode getChild(int index)
    {
	return children.get(index);
    }
    
    public void addChild(TreeNode child)
    {
	children.add(child);
    }
        
    public void setParent(TreeNode parent)
    {
	this.parent = parent;
    }
    
    public String getName()
    {
	return name;
    }
    
    public TreeNode()
    {
    }
    
    public int getChildrenNum()
    {
    	return children.size();
    }

    public void removeChild(int i)
    {
    	if (i<getChildrenNum())
    	{
    		children.remove(i);
    	}
    }
}
